$(document).ready(function(){
	$(".skin").load("/student/common-skin.html",function(){
		$('.skin').click(function(evt){
			if(evt.target==this){
				$(".skin-box").toggle();
			}
		});
		var skin = $("#skinCss").attr("href");
		skin = skin.substring(skin.lastIndexOf("/")+1,skin.lastIndexOf("\."));
		$("#"+skin).find(".div").addClass("select-img");
		
		$(".skin").mouseleave(function(){
			$(".skin-box").hide();
		});
		$(".skin-box ul li").click(function(){
			$.post("/student/user/saveSkin",
					{"skincss":this.id,"deviceType":deviceType},
					function(data){
						if(!data.success){
						}
					},"json");
			$("#"+this.id).find(".div").addClass("select-img");
			$(this).siblings().find(".div").removeClass("select-img");
			$("#skinCss").attr("href","/student/css/default/"+(this.id)+".css");
		});
	});
});

